The following assertion was thrown building Builder:
dependOnInheritedWidgetOfExactType<_ModalScopeStatus>() or dependOnInheritedElement() was called before_examplePage.initState() completed.
When an inherited widget changes, for example if the value of Theme.of() changes, its dependent widgets are rebuilt. If the dependent widget's reference to the inherited widget is in a constructor or an initState() method, then the rebuilt dependent widget will not reflect the changes in the inherited widget.
Typically references to inherited widgets should occur in widget build() methods. Alternatively, initialization based on inherited widgets can be placed in the didChangeDependencies method, which is called after initState and whenever the dependencies change thereafter.
That's a common error in Flutter, if you are passing value to navigation and trying to catch them in initState() method.
Simply speaking, your data is not ready when you are trying to catch them. There are two ways you can solve these issues.
One is using Future.delayed() function and delay few mili-seconds and you will see you are not crashing.
Other method is using didChangeDependencies(), this is the recommended one, let's see the same thing in the method